﻿using SharpGL;
using SharpGL.SceneGraph;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NuiWindowDisplay
{
    public partial class Form1 : Form
    {
        SharpGL.OpenGLControl GL_Display = new SharpGL.OpenGLControl();
      
        public Form1()
        {
            InitializeComponent();
            
            this.Controls.Add(GL_Display);
            GL_Display.Name = "GL_Display";
            GL_Display.RenderContextType = SharpGL.RenderContextType.FBO;
            GL_Display.Dock = System.Windows.Forms.DockStyle.Fill;
            GL_Display.DrawFPS = true;
            GL_Display.FrameRate = 20;
            GL_Display.Location = new Point(0, 0);
            GL_Display.Width = this.Width;
            GL_Display.Height = this.Height;

            GL_Display.OpenGLInitialized += GL_Display_OpenGLInitialized;
            GL_Display.Resized += GL_Display_Resized;
            GL_Display.OpenGLDraw += GL_Display_OpenGLDraw;
        }

        void GL_Display_OpenGLDraw(object sender, RenderEventArgs args)
        {
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        void GL_Display_Resized(object sender, EventArgs e)
        {
            OpenGL gl = GL_Display.OpenGL;
            gl.LoadIdentity();

            gl.Perspective(60.0f, (double)Width / (double)Height, 0.01, 100.0);

            
            gl.LookAt(-5, 5, -5, 0, 0, 0, 0, 1, 0);

           
            gl.MatrixMode(OpenGL.GL_MODELVIEW);

        }

        void GL_Display_OpenGLInitialized(object sender, EventArgs e)
        {
            GL_Display.OpenGL.ClearColor(0, 0, 0, 0);
            
        }

        private void Form1_Resize(object sender, EventArgs e)
        {
          
        }
    }
}
